<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        div {
            position: absolute;
            left: calc(50% - 200px);
            top: 100px;
            height: 100px;
            width: 400px;
            font-size: 60px;
            line-height: 100px;
            font-weight: 700;

            background-image: url("./tree.jfif");
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            /* 记住有这么个属性就行了，这个属性就是配合-webkit-background-clip: text;的 */

            transition: all 1s;
        }
        div:hover {
            background-position: center;
        }

    </style>
</head>
<body>
    <div>成哥很帅</div>
</body>
</html>